//导包
import { createStore } from 'vuex'

//创建一个仓库实例
const Store = createStore({
    //公共 == data
    state () {
      return {
        count: 0,
        musicName:"",
        isLogin:false //全局登录状态
      }
    },
    //以下的方法用于修改state
    mutations: {
      increment (state) {
        state.count++
      },
      changeMusic(state,name){
        state.musicName = name
      },
      logIn(state){//登入
        state.isLogin = true;
      },
      logOut(state){//登出
        state.isLogin = false;
      }
    }
})

//暴露vuex
export default Store;